//
//  GKZYUserLoginView.m
//  GKZYAid
//
//  Created by lanou3g on 16/3/14.
//  Copyright © 2016年 GKZYAid. All rights reserved.
//

#import "GKZYUserLoginView.h"

#define LTVIEW_X ((self.frame.size.width) * 0.15)
#define LTVIEW_WIDTH ((self.frame.size.width) * 0.7)
#define LTVIEW_HEIGHT ((self.frame.size.height) * 0.05)
#define GAP ((self.frame.size.height)  * 0.03)

@implementation GKZYUserLoginView

- (id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self addAllViews];
    }
    return self;
}

- (void)addAllViews
{
    self.backgroundColor = [UIColor whiteColor];
    
    self.imageViewBackground = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.imageViewBackground.image = [UIImage imageNamed:@"background"];
    self.imageViewBackground.userInteractionEnabled = YES;
    self.imageViewBackground.alpha = 0.8;
    [self addSubview:self.imageViewBackground];
    
    self.userName = [[LabelTextFieldView alloc] initWithFrame:CGRectMake(LTVIEW_X, self.frame.size.height * 0.1 + 44, LTVIEW_WIDTH, LTVIEW_HEIGHT)];
    [self.imageViewBackground addSubview:self.userName];
    [self.userName setLabelText:@"用户名:" textFieldPlaceholder:@"请输入用户名" isCiphertext:NO textFieldTag:101];
    
    self.userPassword = [[LabelTextFieldView alloc] initWithFrame:CGRectMake(LTVIEW_X, CGRectGetMaxY(self.userName.frame) + GAP, LTVIEW_WIDTH, LTVIEW_HEIGHT)];
    [self.imageViewBackground addSubview:self.userPassword];
    [self.userPassword setLabelText:@"密码:" textFieldPlaceholder:@"请输入密码" isCiphertext:YES textFieldTag:102];
    
    self.buttonForgetPassword = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonForgetPassword.frame = CGRectMake(self.userPassword.frame.size.width * 0.85, CGRectGetMaxY(self.userPassword.frame) + GAP * 0.8, self.userPassword.frame.size.width * 0.35, LTVIEW_HEIGHT);
    [self.buttonForgetPassword setTitle:@"忘记密码?" forState:UIControlStateNormal];
    [self.buttonForgetPassword setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    self.buttonForgetPassword.font = [UIFont systemFontOfSize:15.0f];
    [self.imageViewBackground addSubview:self.buttonForgetPassword];
    
    self.buttonLogin = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonLogin.frame = CGRectMake(LTVIEW_X, CGRectGetMaxY(self.buttonForgetPassword.frame) + GAP, LTVIEW_WIDTH, LTVIEW_HEIGHT * 1.3);
    [self.buttonLogin setTitle:@"登陆" forState:UIControlStateNormal];
    self.buttonLogin.backgroundColor = [UIColor orangeColor];
    [self.imageViewBackground addSubview:self.buttonLogin];
    
    self.buttonWeChat = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonWeChat.frame = CGRectMake(LTVIEW_X, CGRectGetMaxY(self.buttonLogin.frame) + GAP, LTVIEW_WIDTH, LTVIEW_HEIGHT * 1.3);
    [self.buttonWeChat setTitle:@"使用微信登陆" forState:UIControlStateNormal];
    self.buttonWeChat.backgroundColor = [UIColor orangeColor];
    [self.imageViewBackground addSubview:self.buttonWeChat];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
